import org.apache.log4j.Logger;
import java.util.Random;

public class Logger_py {
    //创建日志对象
    static final Logger logger = Logger.getLogger(Logger_py.class);

    public static void main(String[] args) {
        Random random= new Random();

        for(int n=0;n<100;n++){
            int  result=random.nextInt( 10 );
            int i=result+1;
            if(i <= 4){
                logger.info("Value is {"+i+"} - Everything is fine");
            }
            else if(i <= 6){
                logger.warn("Value is {"+i+"} - System is getting hot");
            }
            else if(i <= 8){
                logger.error("Value is {"+i+"} - Dangerous region");
            }
            else{
                logger.fatal("Maximum value reached");
            }
            try{
                Thread.sleep(300);
            }catch (InterruptedException e){
                e.printStackTrace();
            }
        }
    }

}
